package os.t2;

public class Writer implements Runnable{
    Resources resources;
    public Writer(Resources resources){
        this.resources=resources;
    }


    @Override
    public void run() {
        try{
            while(true){
                resources.wMutex.acquire();//锁住写者
                System.out.println("写者正在写..."+Thread.currentThread().getName());
                resources.wMutex.release();//释放写者
                Thread.sleep(100);
            }
        }catch (Exception e){
            throw new RuntimeException(e);
        }

    }
}
